<html>
<header><h1>Game Of Life Model Overview</h1><header>
    <style>
        table, th, td {
            border: 1px solid black;
            border-collapse: collapse;
        }
    </style>
<body style="font-size: 18px;">


The Game of Life, also known simply as Life, is a cellular automaton devised by the British mathematician John Horton Conway in 1970.
The game is a zero-player game, meaning that its evolution is determined by its initial state, requiring no further input. One interacts with the Game of Life by creating an initial configuration
and observing how it evolves or, for advanced players, by creating patterns with particular properties.


<h2> Model Description</h2>
The universe of the Game of Life is an infinite two-dimensional orthogonal grid of square cells, each of which is in one of two possible states, alive or dead. Every cell interacts with its eight
neighbours, which are the cells that are horizontally, vertically, or diagonally adjacent. At each step in time, the following transitions occur:- Any live cell with fewer than two live neighbours dies, as if caused by under-population.
<u1>
    <li>Any live cell with two or three live neighbours lives on to the next generation</li>
    <li>Any live cell with more than three live neighbours dies, as if by over-population</li>
    <li>Any dead cell with exactly three live neighbours becomes a live cell, as if by reproduction</li>
</u1>
<br>
The initial pattern constitutes the seed of the system. The first generation is created by applying the above rules simultaneously to every cell in the seed—births and deaths occur simultaneously, and the discrete moment at which this happens is sometimes called a tick (in other words, each generation is a pure function of the preceding one).
The rules continue to be applied repeatedly to create further generations.
<h4>References:</h4>
    <u1>
        <li>Wikipedia <a href="https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life"> Game of Life</a> </li>
        <li>Mathematical Games The fantastic combinations of John Conway's new solitaire game life. Scientific American 223.](Gardner, Martin (October 1970). Mathematical Games, The fantastic combinations of John Conway's new solitaire game life. Scientific American 223.)</li>
    </u1>

    <h2> Why this model?</h2>
As described above, the game is completely deterministic and embarrassingly parallelizable (the behavior of a cell depends only on the neighboring cells). Behind deterministic this model is extremely helpful as test for parallel or distributed implementations of ABM on a 2D field (it allows to check.that the synchronization among the Logical Processors (LPs)  does not affect the behavior of the model).

<h4> Initial Conditions</h4>
    The initial conditions of the GOL model is a matrix of 0 (dead cell) and 1 (alive cell), for instance the Glider, shown in following picture, continuously moves in south-east direction.
<div style="margin-left:5%; margin-top:1%;"><img src="images/glider.gif"></div>

<h4> Model Parameters</h4>

<table>
    <tr><td>Parameter &nbsp</td> <td>Desriprion</td></tr>
    <tr><td>W</td> <td>the width of the matrix field</td></tr>
    <tr><td>H</td> <td>the height of the matrix field</td></tr>
    <tr><td>S</td> <td>number of discrete steps to be performed</td></tr>
    <tr><td>I</td> <td>initial configuration matrix, the starting configuration is a matrix of 0 and 1, where 0 is dead cell and 1 is alife cell</td></tr>
    <tr><td>F</td> <td>final configuration matrix, the ending configuration is a matrix of 0 and 1, where 0 is dead cell and 1 is alife cell</td></tr>

</table>

<h2>Suggested Benchmark</h2>

On a 2000 x 1000 field, we position the Glider (initial conditions) on the top-left (0,0) of the matrix field.
<table>
    <tr><td>0 &nbsp</td><td>1 &nbsp</td><td>0 &nbsp</td></tr>
    <tr><td>0 &nbsp</td><td>0 &nbsp</td><td>1 &nbsp</td></tr>
    <tr><td>1 &nbsp</td><td>1 &nbsp</td><td>1 &nbsp</td></tr>
</table>

By construction the glider assumes the same shape each four steps, but moves of one cell in south-east direction. Hence at the end of `7987` time step it reaches the bottom-right of the field.

<table>
    <tr>
        <td>Correctness</td>
        <td>Benchmark to test the correctness of the model implementation. The correctness is checked verifing that, starting <br>with the given initial configuration and performing a certain amount of simulation steps the final configuration <br>
            corresponds with a given final configuration</td>
        <td>W=2000, H=1000, S= 7987, I= a single glider positioned on the top-left of the field, F= a single glider matrix postioned on the bottom-right of the field</td>
    </tr>
</table>
<h2>Reference Implementation</h2>
A reference implementation is provided as part of the <a href="https://github.com/isislab-unisa/dmason/tree/master/src/test/java/it/isislab/dmason/sim/app/GameOfLife">DMASON</a>
</body>
</html>